//
//  MHSearchViewController.m
//  MHO
//
//  Created by papo on 4/26/14.
//  Copyright (c) 2014 maihoang. All rights reserved.
//

#import "MHSearchViewController.h"
#import "Application.h"
#import "MHGameDetailViewController.h"

@interface MHSearchViewController ()

@end

@implementation MHSearchViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self.navibarView removeFromSuperview];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    if (indexPath.section == 1) {
        MHGameDetailViewController* vc = [[MHGameDetailViewController alloc] initWithNibName:@"MHGameDetailViewController" bundle:nil];
        Application* app = [self.data objectAtIndex:indexPath.row];
        vc.appId = app.appId.integerValue;
        vc.app = app;
        [self.parentViewController.navigationController pushViewController:vc animated:YES];
    }
}

@end
